import 'package:flutter/material.dart';

class HomeLike extends StatelessWidget {
  HomeLike({super.key, required this.goodsList});

  List goodsList = [];

  @override
  Widget build(BuildContext context) {
    return ListView.separated(
      shrinkWrap: true,
      physics: const NeverScrollableScrollPhysics(),
      itemBuilder: (context, index) {
        Map item = goodsList[index];
        return Container(
          padding: const EdgeInsets.all(10),
          color: Colors.white,
          child: Row(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Image.network(
                item['goods_image'],
                width: 80,
                height: 80,
              ),
              Expanded(
                child: Padding(
                  padding: const EdgeInsets.only(
                    left: 10,
                  ),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text(
                        item['goods_name'],
                        maxLines: 2,
                        overflow: TextOverflow.ellipsis,
                      ),
                      Text(
                        '已售${item['goods_sales']}件',
                        style: const TextStyle(
                          fontSize: 12,
                          color: Colors.grey,
                        ),
                      ),
                      Text(
                        '¥${item['goods_price_min']}',
                        style: const TextStyle(
                          color: Colors.red,
                        ),
                      )
                    ],
                  ),
                ),
              )
            ],
          ),
        );
      },
      separatorBuilder: (context, index) {
        return Container(
          height: 6,
          color: Colors.grey[200],
        );
      },
      itemCount: goodsList.length,
    );
  }
}
